UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K8NBHEe/om+JZhoLYe2rC1Z7t3AosBM/U7i+VXAQ294='
WHERE
key_id = 'cf4781f62272d305559e5a4cf204751e0e3d403a41c36a1606d775d3d8cdc624'
AND (
token = 'K8NBHEe/om+JZhoLYe2rC1Z7t3AosBM/U7i+VXAQ294='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)