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