UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OzMpaD47EKYH4o9g3hGkiMSghg3xjEbTH3KLUay5uW4='
WHERE
key_id = 'cfd3a05826896d387d426a6709eda75fa06e6622d995f46c030cfafd00a5ebf9'
AND (
token = 'OzMpaD47EKYH4o9g3hGkiMSghg3xjEbTH3KLUay5uW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)