UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZfoP7v0/E50InTTpoQSLS7Nzh07jURWRcBHZudZLgRw='
WHERE
key_id = 'b68ef940a9204b4b5130bd649c661b1493ae0b74dc0b5214fab65c004a256d68'
AND (
token = 'ZfoP7v0/E50InTTpoQSLS7Nzh07jURWRcBHZudZLgRw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)