UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RdB+rmHBx102VYxwUS+FunITMZdAwHaFYhxyy4AxpSg=' 
WHERE 
  key_id = '5390fb3414b33bfd6bdfc011b4ff381636c0abeb0628f3293340e329672f7646' 
  AND (
    token = 'RdB+rmHBx102VYxwUS+FunITMZdAwHaFYhxyy4AxpSg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030