UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YlgOqljbi2IFWofBkaT7UEU3AWGB6wCD524quKJVLNM=' 
WHERE 
  key_id = 'deeef3a2e7572f737a01a3ff410f654c7d9427f8abcaab1f1e62d1f7fa32d46e' 
  AND (
    token = 'YlgOqljbi2IFWofBkaT7UEU3AWGB6wCD524quKJVLNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056