UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F3Cf71z0VBjjcOnoFY/ZvUjIxATQ/4X2ocjG6lIng/M=' 
WHERE 
  key_id = 'dfaed3580b9c47e601dc858bc1560165b442bdbf268d0801a5441eb215acd565' 
  AND (
    token = 'F3Cf71z0VBjjcOnoFY/ZvUjIxATQ/4X2ocjG6lIng/M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037