UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ifwZ+Exl6qkXJXEFc3p5xU9DDYLWeV01gpTfiASQ6W4='
WHERE
key_id = 'e0178f2612a7a1e4e52cb3e3fbb0b8fd5e6a6bf5f88e7a60b33db11230ac9b93'
AND (
token = 'ifwZ+Exl6qkXJXEFc3p5xU9DDYLWeV01gpTfiASQ6W4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)