UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h4nfHm3f0ToSL6ftXHKGX2zV60iqAm1OTxEzWwFflfA='
WHERE
key_id = '4f28bb032aa183d4c509723e7baeb17cdbba6a56c94f6e4c098009085901aea2'
AND (
token = 'h4nfHm3f0ToSL6ftXHKGX2zV60iqAm1OTxEzWwFflfA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)