UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P6hzYbsq2GpN2wij9l07OWDWiaCbEb5Z6R76MYr+hjk='
WHERE
key_id = 'bf3d06b68dc0b1d424f91697bde981b23cf314b75bde490baac550159b3c5b1a'
AND (
token = 'P6hzYbsq2GpN2wij9l07OWDWiaCbEb5Z6R76MYr+hjk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)