UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zMSmkuk0abEDntlp3JtyxKelPV+yk9hJJkU7MOvG54w='
WHERE
key_id = 'e07712b856c8380e28951ac77b5da25d6c74640408f4ae6791823e9f5122cc85'
AND (
token = 'zMSmkuk0abEDntlp3JtyxKelPV+yk9hJJkU7MOvG54w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)