UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cq9yDwITqenVzkR7wFkCQYzmh/7rji0bVK1gsyUub3w=' 
WHERE 
  key_id = '278e121532fa8d3e372066cd247223050f3e91720311ea3d65121b92f01be837' 
  AND (
    token = 'cq9yDwITqenVzkR7wFkCQYzmh/7rji0bVK1gsyUub3w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027