UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5+zzy+mBOh7/GeWxiptZ+mfIFZyh8g6hj+W76HQdz5A='
WHERE
key_id = '2588787a5de2ed5af2492871a56f7b0a623ebbffec4c54d81a4fd896981e7a87'
AND (
token = '5+zzy+mBOh7/GeWxiptZ+mfIFZyh8g6hj+W76HQdz5A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)