UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ia+mLPjjd55X2y3ygMbjXsiXgoRHNeTl0tUl9sdkb7Y=' 
WHERE 
  key_id = '6fd215f4e484231adc25d93ab90e211c7ac0f1495e55938ba59fff5f06438509' 
  AND (
    token = 'Ia+mLPjjd55X2y3ygMbjXsiXgoRHNeTl0tUl9sdkb7Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027