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