UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cYQDauAhPt81Aj4CtMCKAWAjCuygee7ORP7eVdyZZ90=' 
WHERE 
  key_id = '4ba0b5a90c63c5aa0843d1cc86fe6621dc46b1038094547476ba98c3487c74ca' 
  AND (
    token = 'cYQDauAhPt81Aj4CtMCKAWAjCuygee7ORP7eVdyZZ90=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025