UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ur15kZEXhLLJcG0YreY/x9XWe07xaSkFIs8uspS4gEI=' 
WHERE 
  key_id = 'b2769d1f9b090b6f715fdca64275d4641bdf068771f6f9e3d16bb43a1a5e474a' 
  AND (
    token = 'Ur15kZEXhLLJcG0YreY/x9XWe07xaSkFIs8uspS4gEI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032