UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KYcAt5Ps41vI2u2dhIMj4AYbGlKMvTPyAAULqj+PbbY=' 
WHERE 
  key_id = 'dadd1d790a8cb1a28692a0a60f7b8b63ade5421842265f544bc2c89526ffb95e' 
  AND (
    token = 'KYcAt5Ps41vI2u2dhIMj4AYbGlKMvTPyAAULqj+PbbY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053