UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HYZhODNjBXuRNq0Zv1Khjuz4N1eMztzUCXoGE5J8Uu0=' 
WHERE 
  key_id = 'bad5dcac2d06eb590bb288e1bf15b160d72249d4ff9f0120698894b11c513f5a' 
  AND (
    token = 'HYZhODNjBXuRNq0Zv1Khjuz4N1eMztzUCXoGE5J8Uu0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037