UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZPuX5NDEVPeQIoVVOqDmz6y0APDeRhNk61YeBASZGQA='
WHERE
key_id = '12b0250a5676478183e4f75a5df7faa8665205d905e227bfcdc6fb27ae0ad239'
AND (
token = 'ZPuX5NDEVPeQIoVVOqDmz6y0APDeRhNk61YeBASZGQA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)