UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NoqePHe0QERe1T67zU8BpqoCAtuj9SPcGzB5+1Jqypw=' 
WHERE 
  key_id = '438cd216b8947d4c3595c73fdcee199ee1f2367f53a9b3687566184389de70ba' 
  AND (
    token = 'NoqePHe0QERe1T67zU8BpqoCAtuj9SPcGzB5+1Jqypw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019