UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Avgg48dLav+zaM9Y1/EzXZ6tEfIh4dbeHkwuIJRBZ1I=' 
WHERE 
  key_id = '4adf123694a42d0093e5abf555264d41037b20d28b40bee08045581de221cf6c' 
  AND (
    token = 'Avgg48dLav+zaM9Y1/EzXZ6tEfIh4dbeHkwuIJRBZ1I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016