UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6gGnJvUVjP8zlQoQS80odFJ/j0ElsIgGgGCS0kz8yo8='
WHERE
key_id = '7fb7b86ed12d4c06de067d31368bdebd3c36e91fd6891dff609284af81804d3d'
AND (
token = '6gGnJvUVjP8zlQoQS80odFJ/j0ElsIgGgGCS0kz8yo8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)