UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R7scCINGG7Ll9/Igy/tGM8x4zGoyM/G2/F/UKUbKaOI=' 
WHERE 
  key_id = 'e3561c702f79c25113ffcf900cd0205e858b0ea3cc7abc73977e730451db22de' 
  AND (
    token = 'R7scCINGG7Ll9/Igy/tGM8x4zGoyM/G2/F/UKUbKaOI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040