UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BgMyclxncVExhTvP3NH0bP8oOfZAGypGL2ojZeaeL1A='
WHERE
key_id = 'be695b87d5bee4c3c278b92af3717d9d3f64c06bd01496e05ba39115395bacca'
AND (
token = 'BgMyclxncVExhTvP3NH0bP8oOfZAGypGL2ojZeaeL1A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)