UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ty0lAKXkiPlptDSfs0swh14gxp2oE2A9stZoM0+F8zE='
WHERE
key_id = 'b9b3881c0ff7be59465ef77bfb968deac7d25d644c7456fe9a6f61fddb7852fe'
AND (
token = 'ty0lAKXkiPlptDSfs0swh14gxp2oE2A9stZoM0+F8zE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)