UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'chv0h9ZfA7/bFl9Xe78paaWoM+loS//AFELDAILMlvc=' 
WHERE 
  key_id = '009a3db56dd820435f8d4da923bf6e0ef7547fc06a9c9ac0b6ecf5f4c8bc539a' 
  AND (
    token = 'chv0h9ZfA7/bFl9Xe78paaWoM+loS//AFELDAILMlvc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026