UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mGFDGgJr6kCu/F7d1a0GN11/KP0g7Cs8BnKjt6VsnlM=' 
WHERE 
  key_id = '6f7bfccff4812e1fdfa56fcd6d0420ce037b88e4e9ecf00767f736184db8e023' 
  AND (
    token = 'mGFDGgJr6kCu/F7d1a0GN11/KP0g7Cs8BnKjt6VsnlM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022