UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BQ/XOKDgmqpATh0ErPqwKJLGxAOmGNT4v7J6UuSkprY=' 
WHERE 
  key_id = '9908825f93ebea997f3f65fc135ae350cd9ca153f5e188da018c2edfffa688b3' 
  AND (
    token = 'BQ/XOKDgmqpATh0ErPqwKJLGxAOmGNT4v7J6UuSkprY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034