UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd6TL6mcEYBS4ci3w2I0TTzD1OuvMloP6NXtDOZg8cWM='
WHERE
key_id = '51b7325942ae40ddbf548d57a5a86cc5856bb39b1ad2b2262af4b9ce7d0fc6ac'
AND (
token = 'd6TL6mcEYBS4ci3w2I0TTzD1OuvMloP6NXtDOZg8cWM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)