UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T3OSpXoPR/sgk5ijJGhquOh6WwD0Gm1DYbPNsUK6jcg='
WHERE
key_id = '5337457b053faeea9656a385f4d827df8f54ef381f905d392eb15d1c6444e7fb'
AND (
token = 'T3OSpXoPR/sgk5ijJGhquOh6WwD0Gm1DYbPNsUK6jcg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)