UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5LPHWl02i9PT5E3Qn55aokyo3oZkaWi/RWvB4xnnEr4='
WHERE
key_id = 'd7ac3331a7d2b2aeee00658249c6b8e6f12e445223a9e39d73071b423f3aba1f'
AND (
token = '5LPHWl02i9PT5E3Qn55aokyo3oZkaWi/RWvB4xnnEr4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)